package org.linlinjava.litemall.StrategyDesginModel.test;

import org.linlinjava.litemall.StrategyDesginModel.interfaces.MallSaleStrategy;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;

/**
 * 万达广场
 * 服务中心
 *
 * @author zhy
 * @create 2018-11-29 10:24
 **/
@Service
public class MallService {
	HashMap<String, MallSaleStrategy> maps = new HashMap<>();

	public MallService(List<MallSaleStrategy> wandaSaleStrategys) {
		for (MallSaleStrategy wandaSaleStrategy : wandaSaleStrategys) {
			maps.put(wandaSaleStrategy.getType(), wandaSaleStrategy);
		}
	}

	public void saleMethod(String type, String name , BigDecimal money) {
		maps.get(type).sale(name,money);
	}
}
